//
//  ComposeBtn.swift
//  BQWB
//
//  Created by laibingqiang on 16/11/1.
//  Copyright © 2016年 laibingqiang. All rights reserved.
//

import UIKit

class ComposeBtn: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //设置高亮
    override var isHighlighted: Bool{
        
        get{
            return false
        }set{
            
        }
    }
    
    //设置视图
    private func setupUI(){
        
        imageView?.contentMode = .center
        
        titleLabel?.textAlignment = .center
        
        
        titleLabel?.font = UIFont.systemFont(ofSize: 14)
        
        titleLabel?.textColor = UIColor.gray
        
    }
    
    //重写此方法,重新布局子控件
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //图片
        imageView?.width = self.width
        
        imageView?.height = self.width
        
       
        
        imageView?.y = 0
        
        //label
        titleLabel?.width = self.width
        
        titleLabel?.height = self.height - self.width
        
        titleLabel?.x = 0
        titleLabel?.y = self.width
    }
}
